function _typeof(t) {
    return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
        return typeof t;
    } : function(t) {
        return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
    })(t);
}

function isObject(t) {
    var n = _typeof(t);
    return null != t && ("object" == n || "function" == n);
}

function debounce(o, u, t) {
    var f, a, r, c, l, d, y = 0, p = !1, m = !1, n = !0, e = !u && 0 !== u && "function" == typeof requestAnimationFrame;
    if ("function" != typeof o) throw new TypeError("Expected a function");
    function v(t) {
        var n = f, e = a;
        return f = a = void 0, y = t, c = o.apply(e, n);
    }
    function s(t, n) {
        return e ? requestAnimationFrame(t) : setTimeout(t, n);
    }
    function b(t) {
        var n = t - d;
        return void 0 === d || u <= n || n < 0 || m && r <= t - y;
    }
    function x() {
        var t, n, e, o = Date.now();
        if (b(o)) return i(o);
        l = s(x, (n = (t = o) - y, e = u - (t - d), m ? Math.min(e, r - n) : e));
    }
    function i(t) {
        return l = void 0, n && f ? v(t) : (f = a = void 0, c);
    }
    function _() {
        for (var t, n = Date.now(), e = b(n), o = arguments.length, r = new Array(o), i = 0; i < o; i++) r[i] = arguments[i];
        if (f = r, a = this, d = n, e) {
            if (void 0 === l) return y = t = d, l = s(x, u), p ? v(t) : c;
            if (m) return l = s(x, u), v(d);
        }
        return void 0 === l && (l = s(x, u)), c;
    }
    return u = +u || 0, isObject(t) && (p = !!t.leading, r = (m = "maxWait" in t) ? Math.max(+t.maxWait || 0, u) : r, 
    n = "trailing" in t ? !!t.trailing : n), _.cancel = function() {
        void 0 !== l && function(t) {
            if (e) return cancelAnimationFrame(t);
            clearTimeout(t);
        }(l), f = d = a = l = void (y = 0);
    }, _.flush = function() {
        return void 0 === l ? c : i(Date.now());
    }, _.pending = function() {
        return void 0 !== l;
    }, _;
}

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.default = void 0;

var _default = debounce;

exports.default = _default;